﻿using AutoMapper;

namespace HobSoft.SoccerBet2014.Client.ModelsMapper
{
    using dm = Domain.Models;
    public class BfStateConverter : ITypeConverter<string, dm.Game.GameState>
    {
        public dm.Game.GameState Convert(ResolutionContext context)
        {
            var result = dm.Game.GameState.PreGame;
            switch (context.SourceValue.ToString().ToLower())
            {
                case "close":
                    result = dm.Game.GameState.Finish;
                    break;
                case "active":
                    result = dm.Game.GameState.InProgress;
                    break;
                case "pause":
                    result = dm.Game.GameState.InProgress;
                    break;
                default:
                    result = dm.Game.GameState.PreGame;
                    break;
            }
            return result;
        }
    }
}
